import request from '@/utils/request'
import {
  renderUrl
} from '../utils'

const headers = {
  'Content-Type': 'application/json'
}

export function getOrderByIdInfo(data) {
  return request({
    url: renderUrl('/admin/order/detail/{id}', data),
    method: 'GET'
  })
}

export function deliver(data) {
  return request({
    url: '/admin/order/deliver',
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}

export function settings() {
  return request({
    url: '/admin/order/settings',
    method: 'POST',
    extraConfig: {
      loading: false
    }
  })
}

export function sysConfigUpdate(data) {
  return request({
    url: '/admin/order/settings/update',
    method: 'POST',
    data: JSON.stringify(data),
    headers,
    extraConfig: {
      loading: false
    }
  })
}

export function changeConsignee(data) {
  return request({
    url: '/admin/order/changeConsignee',
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}

export function closeOrderPaying(data) {
  return request({
    url: '/admin/order/close',
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}

export function closeOrderPaid(data) {
  return request({
    url: '/admin/order/closeOrder',
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}

export function remarkOrder(params) {
  return request({
    url: '/admin/order/remarkOrder',
    method: 'GET',
    params
  })
}

export function getReturnApplyById(params) {
  return request({
    url: renderUrl('/admin/returnApply/{id}', params),
    method: 'GET'
  })
}

export function updateReturnApplyStatus(data) {
  return request({
    url: renderUrl('/admin/returnApply/update/status/{id}', data),
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}

export function getRefundApplyById(params) {
  return request({
    url: renderUrl('/admin/returnRefund/{id}', params),
    method: 'GET'
  })
}

export function updateReturnRefundStatus(data) {
  return request({
    url: '/admin/returnRefund/update/status',
    method: 'POST',
    data: JSON.stringify(data),
    headers
  })
}
//导入
export function adminimportOrder(data) {
  return request({
    url: '/admin/order/importOrder',
    method: 'POST',
    data: data,
    headers
  })
}
